-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] for loop enhance and using of standard java 11 method writeString for tests #14889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…le. Files. Such calls can be replaced with a call to a Files. readString() or Files. writeString()
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
diemol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @iampopovich!
…ing for tests (SeleniumHQ#14889) * enhance for loop use * method calls that read or write a String as bytes using java. nio. file. Files. Such calls can be replaced with a call to a Files. readString() or Files. writeString() * applying format.sh --------- Co-authored-by: Puja Jagani <[email protected]> Co-authored-by: Diego Molina <[email protected]>
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
This pull request includes several changes to improve the code by replacing the
Files.writemethod with the more conciseFiles.writeStringmethod. Additionally, there is a minor refactor to simplify a loop structure.Codebase simplification:
java/src/org/openqa/selenium/grid/jmx/MBean.java: Refactored a for loop to use enhanced for-loop syntax for better readability.Method replacement:
java/src/org/openqa/selenium/grid/node/docker/DockerSessionFactory.java: ReplacedFiles.writewithFiles.writeStringto simplify writing string content to files.java/test/org/openqa/selenium/UploadTest.java: Updated method to useFiles.writeStringfor writing string content to temporary files.java/test/org/openqa/selenium/edge/EdgeOptionsTest.java: Changed file writing method toFiles.writeStringfor better readability and simplicity.java/test/org/openqa/selenium/environment/webserver/AppServerTestBase.java: Simplified file writing by usingFiles.writeStringinstead ofFiles.write.Motivation and Context
I changed the method calls for writing strings to standard ones from Java 11 to include more standard solutions from the language library. I also replaced looping through the collection with an iterator for better code readability.
Types of changes
Checklist
PR Type
enhancement
Description
MBean.javato use enhanced for-loop syntax for improved readability.Files.writewithFiles.writeStringacross multiple files to simplify file writing operations.Changes walkthrough 📝
MBean.java
Refactor for loop to enhanced for-loop syntaxjava/src/org/openqa/selenium/grid/jmx/MBean.java
DockerSessionFactory.java
Use Files.writeString for writing strings to filesjava/src/org/openqa/selenium/grid/node/docker/DockerSessionFactory.java
Files.writewithFiles.writeString.UploadTest.java
Simplify file writing with Files.writeStringjava/test/org/openqa/selenium/UploadTest.java
Files.writeString.EdgeOptionsTest.java
Update file writing to Files.writeStringjava/test/org/openqa/selenium/edge/EdgeOptionsTest.java
Files.writeString.AppServerTestBase.java
Use Files.writeString for temporary file creationjava/test/org/openqa/selenium/environment/webserver/AppServerTestBase.java
Files.writewithFiles.writeString.NodeTest.java
Simplify file writing in NodeTest with Files.writeStringjava/test/org/openqa/selenium/grid/node/NodeTest.java
Files.writeString.ResourceHandlerTest.java
Refactor file operations to use Files.writeStringjava/test/org/openqa/selenium/grid/web/ResourceHandlerTest.java
Files.writewithFiles.writeStringin tests.TestUtilities.java
Simplify file writing in TestUtilitiesjava/test/org/openqa/selenium/testing/TestUtilities.java
Files.writeString.